<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #d1{
            width: 100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>
    <input type="button" value="移动">
    <input type="button" value="停止">
    <div id="d1">

    </div>
    
    <script src="../js/jquery-1.12.4.min.js"></script>
    <script>
        $("[value=移动]").click(function(){
            $("#d1").animate({
                marginLeft:"500px",
                width:"+=100px",
                height:"+=100px"
            },2000);
            $("#d1").animate({
                marginTop:"500px",
                width:"-=100px",
                height:"-=100px"
            },2000);
        })
        $("[value=停止]").click(function(){
            // $("#d1").stop(true,true);
            $("#d1").finish();
        })
    </script>
</body>
</html>